package com.archie.zhufengfm.adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.archie.zhufengfm.R;
import com.archie.zhufengfm.entity.AlbumDetails;
import com.archie.zhufengfm.entity.Track;
import com.archie.zhufengfm.tasks.BaseTask;

import java.util.List;

/**
 * Created by Archie on 2015/10/23.
 */
public class AlbumTracksAdapter extends BaseAdapter {

    private Context context;

    private List<Track> tracks;

    public AlbumTracksAdapter(Context context, List<Track> tracks) {
        this.context = context;
        this.tracks = tracks;
    }

    @Override
    public int getCount() {
        int ret = 0;

        if (tracks != null) {

            ret = tracks.size();

        }

        return ret;
    }

    @Override
    public Object getItem(int position) {
        return tracks.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View ret = null;

        if (convertView != null) {

            ret = convertView;

        }else{

            LayoutInflater inflater = LayoutInflater.from(context);

            ret = inflater.inflate(R.layout.album_details_track_item, parent, false);
        }

        TextView subTitle = (TextView) ret.findViewById(R.id.album_subtitle);

        Track track = tracks.get(position);

        subTitle.setText(track.getTitle());

        return ret;
    }

    private class ViewHolder{



    }
}
